using System;
using System.Collections.Generic;
using System.Text;

namespace Mono.Graph.PriorityQueue
{
    /// <summary>
    /// IPriorityQueue is base Interface for priority heaps adjusted to Dijkstra-Priam algorithms
    /// </summary>
    /// <typeparam name="T">T is type of compared objects  </typeparam>
    public interface IRangeIndexedPriorityQueue <T> where T : IComparable<T>
    {
        
        /// <summary>
        /// Returns the number of inserted items
        /// </summary>
        int Size { get; }
        /// <summary>
        /// Returns the smallest value in heap
        /// </summary>
        T TopVal { get; }
        /// <summary>
        /// Returns the key of smallest value in heap
        /// </summary>
        int TopKey { get; }
        /// <summary>
        /// Allocates memory for heap
        /// </summary>
        /// <param name="Size">Size is number of diffrent Key-Value pairs that can be inserted into the heap</param>
        /// <remarks></remarks>
        void Create(int Size);
        /// <summary>
        /// Inserts the key-value pair into a Heap
        /// </summary>
        /// <param name="Key">Key is value used for identification of value.<remarks>Key must be true in (0,Size) range </remarks></param>
        /// <param name="Value"></param>
        void Insert(int Key, T Value);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Key"></param>
        /// <param name="NewValue"></param>
        void DecreaseKey(int Key, T NewValue);
        /// <summary>
        /// Removes the smallest value
        /// </summary>
        void Pop();
        /// <summary>
        /// if key indx does not exist Insert(indx , value)
        /// else Decrease Key
        /// </summary>
        /// <param name="indx">must be in range (-1,Size)</param>
        T GetVal(int indx);
        /// <summary>        
        /// if key indx exist return Val[indx]
        /// </summary>
        /// <param name="indx"></param>
        /// <param name="Val"></param>
        void SetVal(int indx, T Val);
    }
}
